<template>
	<view>
		<uni-nav-bar left-icon="arrowthinleft" title="提现" :border="false" :fixed="true" bg="bg-fff" color="#333" @clickLeft="goBack()"></uni-nav-bar>
		<view class="bg-fff padding-x-24">
			<view class="fs-28 color-333 padding-y-24">提现金额</view>
			<view class="solid-bottom flex align-center justify-between">
				<text class="fs-40 color-333">￥</text>
				<input :disabled="disabled" type="text" v-model="subInfo.amount" placeholder="请输入" class="fs-32 margin-left-20 color-333 flex1 h40">
			</view>
			<view class="fs-24 color-999 padding-y-24"><text class="color-zhuse margin-right-10">*</text>提现的起始金额为10.00元</view>
		</view>
		<view class="padding-24 bg-fff margin-top-20">
			<view class="fw-600 flex align-center">
				<view class="bg-zhuse" style="width: 6rpx;height: 30rpx;"></view>
				<text class="fs-30 color-333 margin-left-16">提现方式</text>
			</view>
			<radio-group @change="change">
				<label class="flex align-center justify-between padding-top-30 margin-top-20">
					<view class="flex align-center">
						<image class="ruzhu_pay_style" src="../../static/img/wx.png" mode="aspectFit">
						</image>
						<text class="fs-30 color-333">微信</text>
					</view>
					<radio value="wechat" checked />
				</label>
				<label class="flex align-center justify-between padding-y-30 ">
					<view class="flex align-center">
						<image class="ruzhu_pay_style" src="../../static/img/ali.png" mode="aspectFit">
						</image>
						<text class="fs-30 color-333">支付宝</text>
					</view>
					<radio value="alipay" />
				</label>
			</radio-group>
		</view>
		<view class="padding-x-40 margin-y-60 padding-bottom-30">
			<view @tap="submit()" class="callBtn color-fff radius60 h40 fs-28 text-center">确定</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				subInfo: {
					amount: "",
					method: "wechat",
					type: "",
				},
				disabled:false
			}
		},
		onLoad(opt) {
			this.subInfo.type = opt.type
			if(opt.type == 'deposit'){
				this.disabled = true;
				this.init()
			}
		},
		methods:{
			init(){
				this.$api.deposit_info().then(res => {
					if (res.code == 1) {
						this.subInfo.amount = res.data.deposit;
					}
				})
			},
			submit(){
				this.$api.apply_withdraw(this.subInfo).then(res => {
					this.$msg(res.msg)
					if (res.code == 1) {
						setTimeout(() => {
							uni.navigateBack()
						}, 400)
					}
				})
			},
			change(e){
				this.subInfo.method = e.detail.value;
			}
		}
	}
</script>

<style>
	page{background: #F7F7F7;}
</style>
<style lang="scss" scoped>
	.ruzhu_pay_style{width: 56rpx;height: 56rpx;}
	.callBtn{
		width: 100%;height: 80rpx;line-height: 80rpx;border-radius: 60rpx; background: linear-gradient(to bottom,#FDA730,#FE810A);
	}
</style>